Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


docs/agents/skills/android-webview-bridge/SKILL.md 9ea4efe98ab64cc1294fae7fd9909e6edc4e4c1f (9ea4efe9) Text, 2.94 KB

Tc9d1d9# Skill: android-webview-bridge

Keep Chaquopy backend boot, WebView file choosers, storage locks, and external navigation correct on Android.

Tc9d1d9## When to use

Tff7b72- Changing Ta5d6ff`MainActivity` bridges, file pickers, or storage setup
Tff7b72- Touching Android Python wrapper / Chaquopy packaging
Tff7b72- Identity or database restore pickers on Android
Tff7b72- Debugging empty file pickers or "fresh install" after storage location change

Tc9d1d9## File chooser

Tff7b72- Extension tokens like Ta5d6ff`.identity` are **not** valid MIME types for Ta5d6ff`Intent.EXTRA_MIME_TYPES`.
Tff7b72- Map Ta5d6ff`.ext` accepts to Ta5d6ff`application/octet-stream` and/or Ta5d6ff`*/*`.
Tff7b72- Set Ta5d6ff`EXTRA_ALLOW_MULTIPLE` only when the WebView chooser mode is multi-select.

Tc9d1d9## Storage and lock

Tff7b72- Internal vs external app storage can look like a fresh install if the user picks a different location than previous data.
Tff7b72- Ta5d6ff`fcntl.flock` may be missing. Ta5d6ff`StorageLock` falls back to a PID soft lock.
Tff7b72- Stale Ta5d6ff`.meshchatx.lock` may need clearing in the Chaquopy wrapper path.

Tc9d1d9## Navigation and packaging

Tff7b72- External http(s) links open in the system browser. Do not navigate the WebView away from the app.
Tff7b72- Vendored Ta5d6ff`lxmfy` and Ta5d6ff`rns_filesync` are synced into Chaquopy Ta5d6ff`src/main/python/`. Android pip does not install them like desktop setuptools.
Tff7b72- RNS panic containment matters on Android (see Ta5d6ff`deferred-network-startup`).

Tc9d1d9## RNode on Android

Tff7b72- Chaquopy has no pyjnius. Ship Ta5d6ff`android/app/src/main/python/jnius/` as a shim over Ta5d6ff`java.jclass`.
Tff7b72- Override Ta5d6ff`usb4a` under Ta5d6ff`android/app/src/main/python/usb4a/` and inject the Activity via Ta5d6ff`meshchat_wrapper.start_server(..., activity)`.
Tff7b72- BLE uses bundled Ta5d6ff`able` plus Ta5d6ff`org.able.BLE` (not Kivy PythonActivity).
Tff7b72- RNode flasher is native Ta5d6ff`RNodeFlasherActivity` (USB via Ta5d6ff`UsbSerialHub`, ESP32 ROM flash in Java). WebView only launches it via Ta5d6ff`openRNodeFlasher()`.
Tff7b72- Codec2 requires Ta5d6ff`System.loadLibrary("codec2")` before Python import (see Ta5d6ff`MeshChatApplication`).
Tff7b72- Keep RNS panic containment and Ta5d6ff`panic_on_interface_error = No`.

Tc9d1d9## Key files

Tff7b72- Ta5d6ff`android/app/src/main/java/com/meshchatx/MainActivity.java`
Tff7b72- Ta5d6ff`android/app/src/main/java/com/meshchatx/rnode/RNodeFlasherActivity.java`
Tff7b72- Ta5d6ff`android/app/src/main/java/com/meshchatx/rnode/UsbSerialHub.java`
Tff7b72- Ta5d6ff`android/app/src/main/java/com/meshchatx/rnode/Esp32SerialFlasher.java`
Tff7b72- Ta5d6ff`android/app/src/main/java/com/meshchatx/MeshChatApplication.java`
Tff7b72- Ta5d6ff`android/app/src/main/java/org/able/BLE.java`
Tff7b72- Ta5d6ff`android/app/src/main/python/meshchat_wrapper.py`
Tff7b72- Ta5d6ff`android/app/src/main/python/jnius/`
Tff7b72- Ta5d6ff`android/app/src/main/python/usb4a/`
Tff7b72- Ta5d6ff`android/app/src/main/python/able/`
Tff7b72- Ta5d6ff`meshchatx/android_codec2.py`
Tff7b72- Ta5d6ff`meshchatx/src/backend/android_rnode/`
Tff7b72- Ta5d6ff`meshchatx/src/frontend/js/rnode/AndroidBridge.js`
Tff7b72- Ta5d6ff`docs/agents/conventions/android.md`

Tc9d1d9## Verification

Tff7b72- Unit / bridge-focused tests if present for the change.
Tff7b72- Emulator smoke when file chooser, storage, or boot paths change (CI workflow when available).
Tff7b72- For identity picker changes, also follow Ta5d6ff`identity-restore`.


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────